package util;

import java.time.LocalDateTime;

import org.springframework.context.ConfigurableApplicationContext;

public class AppUtil {
	
	
	private static volatile ConfigurableApplicationContext applicationContext;
	private static volatile String createTime = null;
	
	public static void setApplicationContext(ConfigurableApplicationContext applicationContext_){
		if(applicationContext_==null){
			return;
		}
		if(applicationContext!=null){
			return;
		}
		applicationContext = applicationContext_;
		createTime = LocalDateTime.now().toString();
	}
	
	public static Object getBean(String name){
		if(name==null){
			return null;
		}
		return applicationContext.getBean(name);
	}
	
	public static String getCreateTime(){
		return createTime;
	}


	
}